package com.sketch.controller;

import com.sketch.commom.Result;
import com.sketch.service.UserCollectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author david
 **/
@RestController
@Api(tags = "用户收藏")
@RequestMapping(value = "/api/collect")
public class UserCollectController {
    @Autowired
    private UserCollectService userCollectService;

    @GetMapping("/addOrRemove")
    @ApiOperation("用户收藏/取消收藏")
    public Result addOrRemove(@ApiParam(value = "id") @RequestParam Long id,
                              @ApiParam(value = "用户状态 0取消收藏 1收藏") @RequestParam Integer type) {
        return userCollectService.addOrRemove(id, type);
    }
}
